/**
 * 风险分析
 */
import api from '../../../api';
import { message } from 'antd';
export default {
  namespace: 'riskAnalysisM',

  state: {},

  effects: {
    // 风险变动
    *riskDailyChg({ payload, callback }, { call, put }) {
      const response = yield call(api.profitOverview.riskDailyChg, payload);
      if (response && response.code === 0) {
        callback(response.data || {});
      } else {
        message.error(response && response.msg ? response.msg : '查询风险变动失败');
        console.error(`获取风险变动数据失败，失败原因：${response?.msg}`, 'riskDailyChg/ 接口：portfolio/riskDailyChg/');
        callback({});
      }
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
